{extend name="public/base"}

{block name="title"}
申请售后
{/block}

{block name="style"}
{css href="/static/wechat/css/refund.css" /}
{/block}

{block name="body"}
<div class="pageControl orderDetails">
    <div class="msui_nav msui_navTop" style="border-bottom: 1px solid #cccccc;">
        <a class="msui_navTop-back" href="javascript:history.back();"><i class="micon-back"></i></a>
        <h1 class="msui_navTop-title">我的投诉</h1>
    </div>
    <div class="weui-top">
        <div class="mtab_list-bd">

        </div>
    </div>

</div>
<div id="loadingToast" style="display:none;">
    <div class="weui-mask_transparent"></div>
    <div class="weui-toast">
        <i class="weui-loading weui-icon_toast"></i>
        <p class="weui-toast__content">数据加载中</p>
    </div>
</div>
{/block}

{block name="javascript"}
{js href="/static/wechat/js/refund.js" /}
<script>
    $(function () {
        var obj = {
            'is_more' : true,
            'page' : 1,
            'status' : 0,
            'url' : '{:url("get_complaint_list")}',
        };

        get_list();
        $(window).scroll( function() {
            if (($(document).height() - $(this).scrollTop() - $(this).height()<50) && obj.is_more){
                get_list();
            }
        });

        function get_list() {
            $('#loadingToast').fadeIn(100);
            obj.is_more = false;
            $.ajax({
                type : 'POST',
                url : obj.url + '?page=' + obj.page,
                data : {
                    status : obj.status
                },
                dataType : 'json',
                success : function (msg) {
                    $('#loadingToast').fadeOut(100);
                    if (obj.page == 1) {
                        $(".mtab_list-bd").html(msg.tpl);
                    } else {
                        $(".mtab_list-bd").append(msg.tpl);
                    }
                    // 计算是否还有更多数据
                    if ((msg.data.total - (msg.data.current_page * msg.data.per_page)) > 0) {
                        obj.is_more = true;
                    }
                    obj.page++;
                }
            });
        }
    });
</script>
{/block}